<template>
    <div class="container">
        <div
            class="img"
            @click="$router.push(`/hotel/${data.id}`)"
        >
            <img :src="data.photos" alt="">
        </div>
        <div class="content">
            <div
                class="name"
                @click="$router.push(`/hotel/${data.id}`)"
            >
                {{ data.name }}
            </div>
            <div class="alias">
                {{ data.alias }}
                <span v-if="data.hotellevel">
                    <i
                        v-for="(item, index) in data.hotellevel.level"
                        :key="index"
                        class="iconfont iconhuangguan"
                    />
                </span>
                {{ data.hoteltype.name }}
            </div>
            <div class="message">
                <span class="star">
                    <span
                        v-for="(item) in Math.floor(data.stars)"
                        :key="Math.random()+item"
                    >
                        <i
                            class="el-rate__decimal el-icon-star-on"
                            style="color:#F7BA2A"
                        />
                    </span>

                    <span v-if="data.stars%1!==0">
                        <i
                            class="el-rate__decimal el-icon-star-on"
                            style="color:#EFF2F7"
                        >
                            <i
                                class="el-rate__decimal el-icon-star-on half-width"
                                style="color:#F7BA2A;width:50%;overflow:hidden;"
                            />

                        </i>
                    </span>

                    <span
                        v-for="(item) in 5-Math.ceil(data.stars)"
                        :key="Math.random()+item"
                    >
                        <i
                            class="el-rate__decimal el-icon-star-on"
                            style="color:#EFF2F7"
                        />
                    </span>
                    <span class="font">
                        {{ data.stars }}分
                    </span>
                </span>
                <span class="comment"><p>{{ data.all_remarks }}</p> 条评价</span>
                <span class="notes"><p>{{ data.common_remarks }}</p> 篇游记</span>
            </div>
            <div class="position">
                <i class="el-icon-location" />
                位于:{{ data.address }}
            </div>
        </div>
        <div class="product">
            <div v-for="(item, index) in data.products" :key="index" class="product_item">
                <div class="product_name">
                    {{ item.name }}
                </div>
                <div class="product_price">
                    <span class="price">
                        ￥{{ item.price }}
                    </span>
                    <span>起</span>
                    <span>
                        <i class="el-icon-arrow-right" />
                    </span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props: {
            data: {
                require: true,
                type: Object,
                default () {
                    return {};
                }
            }
        },
        created () {
        }
    };
</script>

<style lang="less" scoped>
.container {
    width: 100%;
    height: 265px;
    padding: 25px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    .img {
        width: 320px;
        margin-right: 20px;
        cursor: pointer;
        img {
            width: 100%;
            height: 100%;
        }
    }
    .content {
        width: 425px;
        .name {
            cursor: pointer;
            font-weight: 400;
            font-size: x-large;
            margin-bottom: 5px;
        }
        .alias {
            color: #999;
            margin-bottom: 8px;
            i {
                color: #f90;
            }
        }
        .message {
            display: flex;
            align-items: center;
            margin-bottom: 8px;
            .star {
                font-size: 22px;
                display: flex;
                align-items: center;
                span {
                    width: 22px;
                    position: relative;
                    .half-width {
                        position: absolute;
                        left: 0;
                        bottom: 0;
                    }
                }
                .font {
                    width: 33px;
                    height: 29px;
                    margin-left: 10px;
                    line-height: 25px;
                    text-align: center;
                    font-size: 14px;
                    color: rgb(255, 153, 0);
                }
            }
        }
        .comment,.notes {
            height: 29px;
            line-height: 25px;
            margin-left: 10px;
            p {
                display: inline-block;
                color: #FF9900;
            }
        }
        .notes {
            margin-left: 15px;
        }
        .position {
            color: #666;
        }
    }
    .product {
        width: 225px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        .product_item {
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 50px;
            border-bottom: 1px solid #ebeef5;
            font-size: 14px;
            color: #606266;
            .product_price {
                height: 100%;
                display: flex;
                width: 100px;
                justify-content: space-around;
                span {
                    display: inline-block;
                    line-height: 50px;
                }
                .price {
                    color: #f90;
                    font-size: larger;
                }
            }
        }
        .product_item:hover {
            background-color: #F5F7FA;
        }
    }
    i {
        position: relative;
    }
}
</style>
